<?php
function admin_submenu($target, $title, $icon, $active)
{
	$link = 'admin/'.$target;
	echo $active ? '<li class="active">' : '<li>';
	echo anchor($link, icon_tag($icon).' '.$title);
	echo '</li>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<?php $this->load->view('admin/_partials/admin_head'); ?>
	<body>
		<div id="global">
			<div id="header">
				<div id="connected_user">
					Connecté en tant que <strong><?= $this->session->userdata('firstname') ?> <?= $this->session->userdata('name') ?></strong><br />
					<?= anchor('admin/config/my_profile', 'Mon profil') ?> |
					<?= anchor('admin/admincontroller/disconnect', 'Déconnexion') ?>
				</div>
				<h1><?= WEBSITE_TITLE ?><br />Administration</h1>
			</div>
			<div id="main">
				<div id="menu">
					<h2 class="ui-state-default ui-corner-all">Site</h2>
					<ul>
						<?php
						$sub = $context['sub_navigation'];
						admin_submenu('contents', 'Pages du site', 'page_white_stack', $sub == 'contents');
						admin_submenu('posts',    'Actualités', 'newspaper',           $sub == 'posts');
						admin_submenu('faqs',     'FAQ', 'help',                       $sub == 'faq');
						admin_submenu('menus',    'Menus', 'sitemap',                  $sub == 'menus');
						?>
					</ul>
					<h2 class="ui-state-default ui-corner-all">Candidats</h2>
					<ul>
						<?php
						admin_submenu('candidats/main_list',       'Liste principale', 'star',          $sub == 'main_list');
						admin_submenu('candidats/index',           'Tous les candidats', 'group',       $sub == 'candidats');
						admin_submenu('candidats/former_students', 'Anciens étudiants', 'user_student', $sub == 'former_students');
						admin_submenu('candidats/promotions',      'Années de promotion', 'date', $sub == 'promotions');
						admin_submenu('emails',                    'E-mails groupés', 'email',          $sub == 'emails');
						?>
					</ul>
					<h2 class="ui-state-default ui-corner-all">Médias</h2>
					<ul>
						<?php
						admin_submenu('medias/files',             'Envoi de fichiers', 'folder', $sub == 'files');
						admin_submenu('medias/picture_galleries', 'Galeries photos', 'picture',  $sub == 'pictures');
						?>
					</ul>
					<h2 class="ui-state-default ui-corner-all">Configuration</h2>
					<ul>
						<?php
						admin_submenu('config/settings',            'Paramètres', 'bricks',         $sub == 'settings');
						admin_submenu('config/my_profile',          'Mon profil', 'vcard',          $sub == 'my_profile');
						admin_submenu('config/administrators',      'Administrateurs', 'user_suit', $sub == 'admins');
						admin_submenu('config/server_tools',        'Outils serveur', 'server',     $sub == 'server');
						?>
					</ul>
				</div>
				<div id="content">
					<?php $this->load->view($context['view_path']); ?>
				</div>
			</div>
			<div id="footer">
				Administration <strong><?= WEBSITE_TITLE ?></strong> - <?= anchor(site_url(), site_url()) ?>
			</div>
		</div>
		<div id="popup_details"></div>
	</body>
</html>
